<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-02-24 20:09:49
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-05-11 17:04:39
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<page-header-wrapper [title]="titleText" [logo]="logo"
  ><ng-template #logo>
    <button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
      <i nz-icon nzType="left" nzTheme="outline"></i>
    </button>
  </ng-template>
</page-header-wrapper>
<nz-card>
  <!-- 数据列表 -->
  <sv-container col="1">
    <sv label="配置名称"> <input style="max-width: 400px" nz-input placeholder="请输入" [disabled]="hiden" [(ngModel)]="configName" /></sv>

    <sv-title> 固定结算费率配置</sv-title>

    <sv label="固定结算费率">
      <nz-input-number
        [disabled]="hiden"
        [nzMin]="0"
        [nzMax]="100"
        [(ngModel)]="accountingRate"
        [nzPrecision]="precision"
        nzPlaceHolder="请输入"
      ></nz-input-number
      >&nbsp;%</sv
    >

    <sv-title>业务量和管理费比例配置</sv-title>

    <sv label="选择配置类型">
      <nz-radio-group [(ngModel)]="configType" [disabled]="hiden">
        <label nz-radio nzValue="1">按全部等级配置</label>
        <label nz-radio nzValue="2">按不同等级配置</label>
      </nz-radio-group>
    </sv>

    <sv col="1">
      <div style="width: 850px" *ngIf="configType == '1'">
        <app-rebate-table #table [(data)]="tabelData" [type]="1" [hiden]="hiden"></app-rebate-table>
      </div>
      <div style="width: 850px" *ngIf="configType == '2'">
        <app-rebate-table #table [(data)]="tabelData" [type]="2" [hiden]="hiden"></app-rebate-table>
      </div>
    </sv>

    <sv-title>关联合伙人配置</sv-title>

    <sv label="合伙人范围">
      <nz-select
        [(ngModel)]="partnerType"
        [disabled]="hiden"
        (ngModelChange)="changePartner(partnerType)"
        style="max-width: 400px; min-width: 200px"
      >
        <nz-option nzValue="1" nzLabel="全部合伙人(默认模板)"></nz-option>
        <nz-option nzValue="2" nzLabel="新注册合伙人"></nz-option>
        <nz-option nzValue="3" nzLabel="自定义合伙人"></nz-option>
      </nz-select>
      <span *ngIf="addStatus" style="padding-left: 15px; color: #0000ff" (click)="add(this.partnerPeopleList)">添加</span>
      <st
        *ngIf="partnerPeopleList?.length > 0"
        #st
        [data]="partnerPeopleList"
        [columns]="columns"
        [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' } }"
        [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
        [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100] }"
        [loading]="false"
        [scroll]="{ x: '1000' }"
      >
      </st>
    </sv>

    <sv label="优先级" col="1">
      <nz-input-number
        style="max-width: 400px; min-width: 200px; margin-left: 28px"
        [(ngModel)]="priority"
        [nzMin]="0"
        [nzMax]="9999"
        [nzStep]="1"
      ></nz-input-number>
      <div style="color: #7F7F7F;margin-left: 28px">
        1、指全部合伙人、新注册合伙人、自定义合伙人三种范围优先执行的顺序，等级数字越大，优先执行该返佣模板<br />
        2、同一合伙人范围的按创建时间最新的执行返佣模板
      </div>
    </sv>
    <!-- <sv label="生效时间" col="1">
      <nz-date-picker
      nzShowTime
      nzFormat="yyyy-MM-dd HH:mm:ss"
      [(ngModel)]="enableTime"
      nzPlaceHolder="请选择，精确到秒"
    ></nz-date-picker>
    </sv> -->

    <sv label="规则说明" col="1">
      <sf
        #sf
        mode="edit"
        [disabled]="hiden"
        [formData]="formData"
        [schema]="schema1"
        [ui]="{ '*': { spanLabelFixed: 10, grid: { span: 16 } } }"
        button="none"
      >
      </sf>
    </sv>

    <sv label="备注" col="1" style="margin-top: 16px">
      <textarea
      maxlength="20"
      placeholder="请输入20个字符"
      [readonly]='hiden'
        style="max-width: 400px; min-width: 200px; margin-left: 40px"
        rows="4"
        nz-input
        [(ngModel)]="remark"
      ></textarea>
    </sv>
  </sv-container>

  <div class="align-center" style="margin-top: 15px" *ngIf="!hiden">
    <button nz-button nzType="primary" (click)="goBack()">取消</button>
    <button nz-button nzType="primary" style="margin-left: 48px" (click)="save()" acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']"
      >提交</button
    >
  </div>
</nz-card>
